//
//  SLXiaLaButton.m
//  translateAi
//
//  Created by 陈镇 on 2023/5/6.
//

#import "SLXiaLaButton.h"


@interface SLXiaLaButton ()

/** <#注释#>*/
@property (nonatomic, strong) UIImageView * icon;
/** <#注释#>*/
@property (nonatomic, strong) QMUILabel * title;
@end
@implementation SLXiaLaButton

+(instancetype)sl_createButtonTitle:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font imageName:(NSString *)imageName selectImageName:(NSString *)selectImageName{
    
    SLXiaLaButton *btn = [[SLXiaLaButton alloc] init];
    
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    btn.titleString = title;
    btn.backgroundColor = UIColorWhite;
    btn.titleLabel.font = font;
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
//    btn.icon = [[UIImageView alloc] init];
//    btn.icon.image = [UIImage imageNamed:imageName];
//    [btn addSubview:btn.icon];
//    
//    btn.title = [QMUILabel createTextColor:color font:font textAlignment:NSTextAlignmentCenter];
//    btn.title.text = title;
//    [btn addSubview:btn.title];

    
    return btn;
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    
//    if (_imageFrame.size.width > 0) {
//        self.icon.frame = CGRectMake(self.width - _imageSize.width - 5, (self.height - _imageSize.height)/2, _imageSize.width, _imageSize.height);
//    }else{
//        self.icon.frame = CGRectMake(self.width - 16 - 5, (self.height - 16)/2, 16, 16);
//    }

//    self.title.frame = CGRectMake(0, 0, self.icon.left, self.height);
    
//    self.layer.masksToBounds = YES;
//    self.layer.cornerRadius = 16;
}
-(void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    [self setTitle:titleString forState:UIControlStateNormal];
}

@end
